import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SWrestleRoom } from "./SWrestleRoom";
//class SeqSWrestleRoomHelper

export class SeqSWrestleRoomHelper {
  public static write(
    stream: SerializeStream,
    datas?: Array<SWrestleRoom>
  ): void {
    if (datas) {
      stream.writeSize(datas.length);
      var i = 0;
      while (i < datas.length) {
        datas[i].__write(stream);
        ++i;
      }
    } else {
      stream.writeSize(0);
    }
  }

  public static read(stream: SerializeStream): Array<SWrestleRoom> {
    var size = stream.readSize();
    stream.checkFixedSeq(size, 25);
    var datas: SWrestleRoom[] = [];
    var i = 0;
    while (i < size) {
      let sw = new SWrestleRoom();
      sw.__read(stream);
      datas[i] = sw;
      ++i;
    }
    return datas;
  }
}
